package com.itheima.controller;

import com.itheima.autoconfig.template.OssTemplate;
import com.itheima.service.MinioService;
import com.itheima.vo.MinioVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.management.Query;

/**
 * @author 芝士雪豹
 * @create 2022/10/11/15:30
 */
@RestController
@RequestMapping("/minio")
public class MinioController {

    @Autowired
    private MinioService minioService;

    //文件上传
    @PostMapping("upload")
    public ResponseEntity upload(@RequestBody MultipartFile file) {
        MinioVo vo = minioService.upload(file);
        return ResponseEntity.ok(vo);
    }
    //删除文件
    @PostMapping("/delete")
    public ResponseEntity delete(@RequestBody String objectName ) {
        return ResponseEntity.ok(null);
    }

}
